package com.hziee.graduate.ticket.controller;

import com.hziee.graduate.ticket.dto.PageDTO;
import com.hziee.graduate.ticket.dto.R;
import com.hziee.graduate.ticket.entity.Comment;
import com.hziee.graduate.ticket.service.CommentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("comment")
public class CommentController {

    @Resource
    private CommentService commentService;

    @PostMapping("addRate")
    public R<String> addComment(@RequestBody Map<String, String> map) {
        return commentService.addRate(map);
    }

    @GetMapping("getLimitCommentByMovieId/{movieId}/{currentPage}")
    public R<PageDTO<Comment>> getLimitCommentByMovieId(@PathVariable Long movieId, @PathVariable Long currentPage) {
        return commentService.getLimitCommentByMovieId(movieId,currentPage);
    }
}

